package xyz.jcat.common.web;

public enum RespCodeMsg implements RespExceptionAssert {

    OK(200, "OK"),
    REQUEST_PARAMETER_ERROR(400, "请求参数错误"),
    UNAUTHORIZED(401, "未登陆"),
    FORBIDDEN(403, "未授权"),
    NOT_FOUND(404, "请求地址错误"),
    METHOD_NOT_SUPPORTED(405, "请求方式错误"),
    ACCOUNT_OR_PWD_ERROR(450, "账号或密码错误"),
    INVALID_TOKEN(451, "无效token"),
    ACCOUNT_DISABLE(451, "账号已被禁用"),
    ACCOUNT_LOCKED(452, "账号被锁定"),
    ACCOUNT_EXPIRED(453, "账号已过期"),
    CREDENTIALS_EXPIRED(454, "权限已过期"),
    TOKEN_EXPIRED(455, "token过期"),
    PHONE_OR_PWD_ERROR(456, "手机号或密码错误"),
    SYSTEM_ERROR(500, "系统异常"),

    //通用业务异常
    SERVICE_ERROR(555, "业务异常"),
    DATA_NOT_FOUND(444, "数据不存在"),
    TIME_OUT(501, "系统繁忙"),
    FORM_SUBMIT_TIMEOUT(502, "表单提交超时"),
    FORM_SUBMIT_REPEATED(503, "表单重复提交"),
    DATA_EXIST(504, "数据已存在"),
    SENSITIVE_WORD_EXIST(505, "提交内容存在敏感词汇"),
    LOGIN_ERROR(506, "登录失败"),
    INVALID_CAPTCHA(507, "验证码已失效"),
    CAPTCHA_ERROR(508, "验证码错误");

    private int code;
    private String msg;

    RespCodeMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }
}
